<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        Math.random() //取到【0，1）的小数，取不到1

        //想要取到0-10的随机数
        Math.floor(Math.random() * (10 + 1))//因为random会出来小数，所以让floor向下取整
        console.log(Math.floor(Math.random() * (10 + 1)));
        //抽数组里的数或者内容
        let arr = ['ss', 'ss', 'ee']
        let random = Math.floor(Math.random() * arr.length)
        console.log(random);
        console.log(arr[random]);
        //取到5-10的整数
        Math.floor(Math.random() * (5 + 1)) + 5
    </script>
</body>

</html>